<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('商户信息列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>商户编号：</label>
                            <input type="text" name="merno"/>
                        </li>
                        <li>
                            <label>商户名称：</label>
                            <input type="text" name="merName"/>
                        </li>
                        <li>
                            <label>联系人：</label>
                            <input type="text" name="link_man"/>
                        </li>
                        <li>
                            <label>联系方式：</label>
                            <input type="text" name="link_phone"/>
                        </li>
                        <li>
                            <label>结算人名：</label>
                            <input type="text" name="accounts.screenName"/>
                        </li>
                        <li>
                            <label>结算卡号：</label>
                            <input type="text" name="screen_num"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('merchantInfo:merchantInfo:edit')}]];
    var removeFlag = [[${@permission.hasPermi('merchantInfo:merchantInfo:remove')}]];
    var prefix = ctx + "merchantInfo/merchantInfo";
    var merType = [[${@dict.getType('mer_type')}]];
    var merStatus = [[${@dict.getType('mer_status')}]];
    $(function () {
        var options = {
            url: prefix + "/merInfoList",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "商户信息",
            clickToSelect: true,
            columns: [
                {
                    field: 'merno',
                    title: '商户编号',
                },
                {
                    field: 'merName',
                    title: '商户名称',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 3);
                    }
                },
                {
                    field: 'accounts.screenName',
                    title: '结算人'
                },
                {
                    field: 'accounts.showScreenidnum',
                    title: '结算人身份证号'
                },
                {
                    field: 'accounts.showScreennum',
                    title: '结算人卡号'
                },

                {
                    field: 'accounts.bankHeadname',
                    title: '总行',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 5);
                    }
                },
                {
                    field: 'accounts.bankName',
                    title: '开户行',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 4);
                    }
                },
                {
                    field: 'linkMan',
                    title: '联系人'
                },
                {
                    field: 'linkPhone',
                    title: '联系电话'
                },
                {
                    field: 'legalName',
                    title: '法人姓名'
                },
                {
                    field: 'legalCerno',
                    title: '法人证件号'
                },
                {
                    field: 'merareas',
                    title: '商户注册地址'
                },
                {
                    field: 'merdetailedaddress',
                    title: '商户注册详细地址',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 6);
                    }
                },
            ]
        };
        $.table.init(options);
    });
    function userRecord() {
        var merNo = $.table.selectColumns("merno")
        if ($.common.isEmpty(merNo)) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.openTab("用户行为记录", prefix + '/userRecord/' + merNo);
    }
    function lookImg() {
        var merNo = $.table.selectColumns("merno")
        if ($.common.isEmpty(merNo)) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        // $.modal.open("查看图片", prefix + '/lookImg/' + merNo, '1200');

        //如果是移动端，就使用自适应大小弹窗
        var width = 1000;
        var height = $(window).height() - 50;
        if ($.common.isMobile()) {
            width = 'auto';
            height = 'auto';
        }
        var url = prefix + '/lookImg/' + merNo;
        var btn = ['关闭'];
        var options = {
            title: '查看图片',
            width: width,
            height: height,
            url: url,
            btn: btn,
            yes: function (index) {
                layer.close(index);
            }
        };
        $.modal.openOptions(options);
    }
    function cancelMer() {
        var merNo = $.table.selectColumns("merno")
        if ($.common.isEmpty(merNo)) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.open("注销商户", prefix + "/cancelMer/" + merNo, '800');
    }
    function updateAddress() {
        var merNo = $.table.selectColumns("merno")
        if ($.common.isEmpty(merNo)) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.open("修改注册地址", prefix + "/updateAddress/" + merNo, '800');
    }
    function updateBank() {

        var merNo = $.table.selectColumns("merno");
        var selectMerStatus = $.table.selectColumns("merStatus");
        if (0 != selectMerStatus&&1 != selectMerStatus&&9!=selectMerStatus) {
            $.modal.alertWarning("请选择人脸,正式,停用的商户");
            return;
        }
        $.modal.open("修改结算银行", prefix + "/updateBank/" + merNo, '1000');
    }
    function updateSettle() {
        var merNo = $.table.selectColumns("merno")
        if ($.common.isEmpty(merNo)) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        $.modal.open("修改结算类型", prefix + "/updateSettle/" + merNo, '800');
    }
</script>
</body>
</html>